Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update AbstractSoapClientBase.php #50

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

devloic
Copy link

@devloic devloic commented May 28, 2023

As an enhancement (?) , for those who need to change the http header globally, we could allow stream_context to be passed through options once so it would not be necessary to call setHttpHeader() before each request.

The code for including some header would be :

$options = array(
\WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => 'https://somewebservice?wsdl',
\WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => ClassMap::get(),
);

$aHTTP['http']['header'] = "myheader: myheadervalue"; $context = stream_context_create($aHTTP);
$options2=array_merge($options,array("stream_context" => $context));

$someservice = new \ServiceType\SomeServiceClass($options2);

includes fix from fougere2713/42_php8_compatibility_fix

Anthony Donnefort and others added 5 commits December 9, 2022 15:29
As an enhancement (?) , for those who need to change the http header globally, we could allow stream_context to be passed through options once so it would not be necessary to call setHttpHeader() before each request.

The code for including some header would be : 

$options = array(
   \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => 'https://somewebservice?wsdl',
    \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => ClassMap::get(),
);

$aHTTP['http']['header'] =  "myheader: myheadervalue";
$context = stream_context_create($aHTTP);
$options2=array_merge($options,array("stream_context" => $context));

$someservice = new \ServiceType\SomeServiceClass($options2);
using isset to avoid warning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant